package net.designbased.jspfire;

import com.thoughtworks.xstream.annotations.*;

/**
 * 数据结点
 * @author chenhongliang
 */
@XStreamAlias("vc:DataPoint")
public class DataPoint {
    @XStreamAlias("XValue")
    @XStreamAsAttribute
    private String xValue;

    @XStreamAlias("YValue")
    @XStreamAsAttribute
    private String yValue;

    @XStreamAlias("ShowInLegend")
    @XStreamAsAttribute
    private boolean showInLegend = true;

    @XStreamAlias("LegendText")
    @XStreamAsAttribute
    private String legendText;

    @XStreamAlias("AxisXLabel")
    @XStreamAsAttribute
    private String axisXLabel;

    @XStreamAlias("LabelEnabled")
    @XStreamAsAttribute
    private boolean labelEnabled;

    @XStreamAlias("LabelText")
    @XStreamAsAttribute
    private String labelText;

    @XStreamAlias("ToolTipText")
    @XStreamAsAttribute
    private String toolTipText;

    /**
     * X轴的值
     * @return
     */
    public String getXValue(){
        return this.xValue;
    }

    /**
     * 设置X轴的值
     * @param xValue
     */
    public void setXValue(String xValue){
        this.xValue = xValue;
    }

    /**
     * Y轴的值
     * @return
     */
    public String getYValue(){
        return this.yValue;
    }

    /**
     * 设置Y轴的值
     * @param yValue
     */
    public void setYValue(String yValue){
        this.yValue = yValue;
    }

    /**
     * 是否在图例中显示
     * @return
     */
    public boolean isShowInLegend(){
        return this.showInLegend;
    }

    /**
     * 设置是否在图例中显示
     * @param showInLegend
     */
    public void setShowInLegend(Boolean showInLegend){
        this.showInLegend = showInLegend;
    }

    /**
     * 图例文本
     * @return
     */
    public String getLegendText(){
        return this.legendText;
    }

    /**
     * 设置图例文本
     * @param legendText
     */
    public void setLegendText(String legendText){
        this.legendText = legendText;
    }

    /**
     * X轴的文本
     * @return
     */
    public String getAxisXLabel(){
        return this.axisXLabel;
    }

    /**
     * 设置X轴的文本
     * @param axisXLabel
     */
    public void setAxisXLabel(String axisXLabel){
        this.axisXLabel = axisXLabel;
    }

    /**
     * 是否显示X轴文本
     * @return
     */
    public boolean isLabelEnabled(){
        return this.labelEnabled;
    }

    /**
     * 设置是否显示X轴文本
     * @param labelEnabled
     */
    public void setLabelEnabled(Boolean labelEnabled){
        this.labelEnabled = labelEnabled;
    }

    /**
     * 文本值
     * @return
     */
    public String getLabelText(){
        return this.labelText;
    }

    /**
     * 设置文本值
     * @param labelText
     */
    public void setLabelText(String labelText){
        this.labelText = labelText;
    }

    /**
     * 提示文本值
     * @return
     */
    public String getToolTipText(){
        return this.toolTipText;
    }

    /**
     * 设置提示文本值
     * @param toolTipText
     */
    public void setToolTipText(String toolTipText){
        this.toolTipText = toolTipText;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final DataPoint other = (DataPoint) obj;
        if ((this.xValue == null) ? (other.xValue != null) : !this.xValue.equals(other.xValue)) {
            return false;
        }
        if ((this.yValue == null) ? (other.yValue != null) : !this.yValue.equals(other.yValue)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        return this.xValue.hashCode() + this.yValue.hashCode();
    }
}
